package com.sztx.pay.data.transfer;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.tools.ant.types.CommandlineJava.SysProperties;

public class BankTransfer {
	public static void main(String[] args) {
		
		try {
			List<String> list = FileUtils.readLines(new File("E:\\支付分离\\tbl_Withdraw_Account.txt"),"GBK");
			int temp = 0;
			for (String string : list) {
				String[] tmp = string.split("	");
//				String url = "http://cashier.berbon.com/account/bindCard?";
				String cardActType = "null";
				String cardType = "null";
				int num = 100 + temp;
				String bindCardNo = "BC000"+num;
				String sql = "insert into user_bind_card(bind_card_no,user_id,real_name,card_no,card_act_type,card_type,`status`,create_time,bind_type,is_main_card,swift_code,bank_name) VALUES('%s',%s,'%s','%s',%s,%s,1,'%s',%s,0,%s,%s);";
				String id = tmp[0];
				//System.out.print(id);
				String shopId = tmp[1];
				//System.out.print(shopId);
				String userId = tmp[2];
				//System.out.print(userId);
				String accountType = new Integer(tmp[3]) + 1 + "";
				//System.out.print(accountType);
				String accountName = tmp[4];
				//System.out.print(accountName);
				String accountNo = tmp[5]; 
				//System.out.print(accountNo);
				String bankId = StringUtils.isEmpty(tmp[6]) ? "null" : "'" +tmp[6]+"'"; 
				//System.out.print(bankId);
				String bankName = StringUtils.isEmpty(tmp[7]) ? "null" : "'" +tmp[7]+"'";  
				//System.out.print(bankName);
				String status = tmp[8]; 
				//System.out.print(status);
				String updateTime = tmp[9]; 
				//System.out.print(updateTime);
				String createTime = tmp[10]; 
				//System.out.print(createTime);
//				System.out.println("");
				if (accountType.equals("2")) {
					cardActType = "1";
					cardType = "1";
				}
				String reSql = String.format(sql, bindCardNo,userId,accountName,accountNo,cardActType,cardType,createTime,accountType,bankId,bankName);
				System.out.println(reSql);
//				userId=%s&bindType=2&cardActType=1&cardType=1&cardNo=s&realName=%sidentityNo=%s&mobileNo=%s
				for (int i = 0; i < tmp.length; i++) {
//					System.out.print(tmp[i]);
				}
//				System.out.println("");
				
				temp++;
				
			}
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}

}
